<template>
  <div class="home">
    <!-- <p>{{number}}</p> -->
    <p>年后开始搬砖的第{{num}}天</p>
    <button @click="add">搬砖计时器</button>
  </div>
</template>

<script>
import { mapState,mapMutations } from 'vuex';
// mapState state的辅助函数
export default {
  name: 'Home',
  components: {
   
  },
  data(){
    return{
      // num: this.$store.state.count
    }
  },
  computed:{
    //  ...mapState(['count','number'])
    ...mapState({
      num: state => state.count
    })
    // num(){
    //   return this.$store.state.count
    // }
  },
  methods: {
    // ...mapMutations(['storeAdd']),
    ...mapMutations({
      add: 'storeAdd'
    })
    // add(){
    //   this.$store.commit('storeAdd')
    // }
  },
}
</script>
